package com.pro01.backend.service;

import com.pro01.backend.pojo.PageResult;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.pro01.backend.mapper.AdminConnectionMapper;
import com.pro01.backend.dto.UserConnectionStatusDTO;

import java.util.List;

@Service
public class AdminConnectionService {

    @Autowired
    private AdminConnectionMapper adminConnectionMapper;

    public PageResult<UserConnectionStatusDTO> getAllUserConnections(int pageNum, int pageSize) {
        int offset = (pageNum - 1) * pageSize;
        List<UserConnectionStatusDTO> list = adminConnectionMapper.getAllUserConnectionStatus(offset, pageSize);
        int total = adminConnectionMapper.countAllUsers();
        return new PageResult<>(total, list);
    }
}
